// 主界面
;
define(function(require, exports, module) {
	'use strict';
	var util = require("util");
	var base = require("base");
	var router = require("../hash/pageRouter");
	var _css = require("./wareHouseDetail.css");
	var databind = require("databind");
	var tools = require("tools");
	var warehouseId;
	var leftMenu = require("../leftMenu/leftMenu");
	var pickupNumber;
	var init = function(page) {
		router.init();
		pickupNumber = page.params.pickupNumber;
		warehouseId = page.params.warehouseId;
//		leftMenu.init(11);
		initEvent();
	};
	var initEvent = function() {
		returnOutboundDetailInfo(pickupNumber, warehouseId);
	};

	//从仓储系统查询出库详情信息
	var returnOutboundDetailInfo = function(pickupNumber, warehouseId) {
		base.fnAjax({
			action: "returnOutboundDetailInfo.json",
			oData: {
				pickupNumber: pickupNumber,
				warehouseId: warehouseId
			}, //传递参数
			fnSuccess: function(data) {
				if (data.status == 200) {
					data.datas[0].result.pickupNumber = pickupNumber;
					databind.fillForm($("#wareHouseDetail"), data.datas[0].result);
					//入库明细表
					$.each(data.datas[0].result.photofile.split(','), function(){
						var _this = this;
						var str = '<a target="_blank" href="'+_this+'"><img src="'+_this+'"></a>'
						$("#wareHouseDetail .goodsFile").append(str);
					});
					
					//磅单
					$.each(data.datas[0].result.poundfile.split(','), function(){
						var _this = this;
						var str = '<a target="_blank" href="'+_this+'"><img src="'+_this+'"></a>'
						$("#wareHouseDetail .poundFile").append(str);
					});
					
//					//检验单
//					$.each(data.datas[0].result.inspectionsheet_photos.split(','), function(){
//						var _this = this;
//						var str = '<a target="_blank" href="'+_this+'"><img src="'+_this+'"></a>'
//						$("#wareHouseDetail .inspectionsheet_photos").append(str);
//					});
//					
//					//货物图片
//					$.each(data.datas[0].result.cargo_photos.split(','), function(){
//						var _this = this;
//						var str = '<a target="_blank" href="'+_this+'"><img src="'+_this+'"></a>'
//						$("#wareHouseDetail .cargo_photos").append(str);
//					});
				} else {
					base.alert(2, data.message);
				}
			}
		});
	}
	
	return {
		init: init
	};

});